/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package beans;

import entity.Tweet;
import entity.Users;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.bean.RequestScoped;
import sessionbeans.TweetFacade;
import sessionbeans.UsersFacade;

/**
 *
 * @author Axel
 */
@ManagedBean(name="ListTweetBean")
@RequestScoped
public class ListTweetBean {
    
     @EJB
    private TweetFacade tf;

    @ManagedProperty(value="#{userBean}") // #{user} is the managed bean name
    private sessionUserBean userBean;

    private List<Tweet> listOfTweet;

    /** Creates a new instance of ListUserBean */
    public ListTweetBean() {
    }

    @PostConstruct
    public void init(){
       this.setListOfTweet(this.getTf().findAll());
    } 

    public List<Tweet> getListOfTweet() {
        return listOfTweet;
    }

    public void setListOfTweet(List<Tweet> listOfTweet) {
        this.listOfTweet = listOfTweet;
    }

    public TweetFacade getTf() {
        return tf;
    }

    public void setTf(TweetFacade tf) {
        this.tf = tf;
    }


    /**
     * @return the userBean
     */
    public sessionUserBean getUserBean() {
        return userBean;
    }

    /**
     * @param userBean the userBean to set
     */
    public void setUserBean(sessionUserBean userBean) {
        this.userBean = userBean;
    }

}
